/* Profile file for environment variables and parameters. */
***************************** Stata Settings ***********************************
set varabbrev off
set seed 4645132
set trace off
set tracedepth 1
***************************** System Specific Paths ****************************
* Note: root should end in "test_environment\infrastructure"

global orig "${root}\orig\" 

adopath ++"${root}\ado\"
capture mkdir "Z:\ado"      // create directory (if non-existent)
capture mkdir "Z:\ado\plus" // create directory (if non-existent)
sysdir set PLUS "Z:\ado\plus"
cap net install estout,   from("N:\Ablagen\D01700-Allgemein\STATA\bocode\e")
cap net install gtools,   from("N:\Ablagen\D01700-Allgemein\STATA\bocode\g")
cap noi gtools

***************************** Relative Paths ***********************************
global subproject infrastructure
global data         $root/data
global orig         $root/orig
global prog         $root/prog
****** Ado paths: Only hand-written files and code repository files allowed
cap noi adopath - PLUS // net install
cap noi adopath - PERSONAL 
cap noi adopath - OLDPLACE 
cap noi adopath - "."
* Add self-written programs from test-environment
adopath ++ "$prog/ado"
adopath ++ "$root/ado"
adopath ++ "$root/ado/ado_ext/plus"
sysdir set PLUS "$root/ado/ado_ext/plus"
* Some all purpose ado-files
do $prog/ado_packages.do
* For IZA Server it might not be possible to load ado-files from outside server
if regexm("`c(username)'", "iza"){
    // this path should already be there but just in case
    adopath ++ Z:\ado\personal
    * Copy all written ado files to server
    local filelist : dir "$prog/ado" files "*.ado" 
    
    foreach f of local filelist { 
        copy $prog/ado/`f'  Z:/ado/personal/, replace
    } 
}
* Create output directories with relative time
local temp_date: display %td_CCYY_NN_DD date(c(current_date), "DMY")
local date = subinstr(trim("`temp_date'"), " " , "-", .)
local time = subinstr("`c(current_time)'", ":", "", .)
local name = subinstr("`c(username)'", " ", "", .)
cap mkdir           $root/out
global latex        $out/latex
global graph        $out/graph
global log          $out/log
foreach x in data orig out latex graph log{
    cap mkdir "$`x'"
}
***************************** System Specific File Names ***********************
* These are files that are used repeatedly (either raw or generated)
* All these files should be located in orig (or data for generated files)
* Specify without ".dta" ending
global ieb_linked           a015179_ieb_konten
global ieb_coworker         coworker_fullhist_IEB
global linkage_table        SOEP-ADIAB_7519_v1_key_IAB
global bhp                  bhp_7519_m06_v2 
global soep_para            soep_para
* Sometimes this is required to run gtools (e.g. IAB environment)
mata: mata mlib index
***************************** Global Graph Settings ****************************
set graph on
set scheme s1color
* Bin scatter does not use the global scheme, so provide additional global
global bin_scheme scheme(s1color)
***************************** Global Table Settings ****************************
* Standard table options
#delimit ;
global table_options
	replace fragment noobs nonumber brackets nomtitles compress nogaps nolines se(3);
#delimit cr
* Extra title to be used in test sessions
if $test_session == 0 global titletest
********************************************************************************
di "Output folder is now: " "$out"